The present invention relates generally to a method and apparatus for memory management and more specifically, to a method and apparatus for ensuring that memory pages will always be present and mapped in the memory of a data processing system.
Many types of general purpose computers and data processing systems contain memory that is organized using a "virtual memory" scheme. In general virtual memory allows applications and/or processes that are executing in the computer to behave as if they have an unlimited amount of memory at their disposal. In actuality, the amount of memory available to a particular application or process is limited by the amount of memory in the data processing system and further limited by the number of concurrently executing programs sharing that memory. In addition, a virtual memory scheme hides the actual physical address of memory from the application programs. Application programs access their memory space using a logical address, which is then converted to a physical address by the data processing system.
A virtual memory system organizes memory in units called "pages." These pages are moved between a fast, primary memory and one or more larger and usually slower secondary, tertiary, etc. memories. The movement of pages (often called "swapping") is transparent to the applications or processes that are executed in the data processing system, enabling the applications or processes to behave as if they each have an unlimited amount of memory.
A page fault occurs when an application program requests a particular page of memory, but that page is not present in memory, or when a particular page is present but not yet mapped into the program's address space (i.e., when the page is not "mapped"). Operating systems usually respond to a page fault by bringing the missing page into memory and mapping it. Bringing the page into memory and/or mapping it, however, can be too time-consuming for certain application programs.
Therefore, many data processing systems allow application programs (or users) to "lock" memory. Locking memory means that the memory is guaranteed to be present in the memory of the data processing system and that it will not be swapped out. Locking some or all of the memory avoids "page faults" for the locked memory because the locked pages are guaranteed to be present. Locking some or all of memory may not, however, guarantee that the memory is mapped.
While some conventional systems implement a virtual paging scheme that allows applications and/or processes executing on the system to share memory, these data processing systems generally do not guarantee that shared memory will be mapped.